﻿using System;
using System.Linq;
using System.Activities;
using System.Activities.Statements;
using System.Collections.Generic;

namespace OrderProcess
{

    class Program
    {
        static void Main(string[] args)
        {
            Order myOrder = new Order
            {
                OrderID = 1,
                Description = "Need some stuff",
                ShippingMethod = "2ndDay",
                TotalWeight = 100
            };

            myOrder.Items.Add(new OrderItem
            {
                OrderItemId =1,
                Quantity =1,
                ItemCode = "12345",
                Description = "Widget"
            });

            myOrder.Items.Add(new OrderItem
            {
                OrderItemId = 2,
                Quantity = 3,
                ItemCode = "12346",
                Description = "Gadget"
            });

            myOrder.Items.Add(new OrderItem
            {
                OrderItemId = 3,
                Quantity = 2,
                ItemCode = "12347",
                Description = "Super Widget"
            });

            IDictionary<string, object> input = new Dictionary<string, object>  
            { 
                { "OrderInfo" , myOrder } 
            };

            IDictionary<string, object> output = WorkflowInvoker.Invoke(new OrderWF(), input);

            decimal total = (decimal)output["TotalAmount"];
            Console.WriteLine("Workflow returned ${0} for my order total", total);
        }
    }
}
